import { getCookie } from '_commonFn/cookie'

export function setUserShareLoginUrlInfo({
    urlType = '', 
    userId = getCookie('UserId'),
    wholeData
}){
    if(wholeData){
        sessionStorage.setItem('USER_SHARE_URL_INFO', `${wholeData}`)
    }else if(urlType){
        const urlTypeObj = {
            quiz: 'Quiz',
            clue: 'Clue',
            associationProduct: 'GroupCP',
            associationTrade: 'GroupHY',
            associationExhibition: 'GroupZH',
            discuss: 'GroupDiscuss',
            myIntegralList: 'MyIntegral',
            wechatUserItem: 'WechatUserItem',
            wechatListItem: 'WechatListItem',
            weChatGroupDetails: 'WeChatGroupDetails',
            masksLottery: 'MasksLottery',
        }
        if(urlTypeObj[urlType]){
            if(userId){
                sessionStorage.setItem('USER_SHARE_URL_INFO', `${urlTypeObj[urlType]}_${userId}`)
                console.log('USER_SHARE_URL_INFO 缓存成功')
            }else{
                console.log('分享用户ID为空或其他 userId:', userId)
            }
        }else{
            console.log('传入参数urlType不是对应的有效值，urlType：', urlType)
        }
    }else{
        console.log('传入的两个值（urlType、wholeData）都为空或其他无效值')
    }
}